package com.wuxiaoqin.admin.controller;


import com.wuxiaoqin.admin.entity.loginParam.AdLoginParam;

import com.wuxiaoqin.admin.service.IAdService;
import com.wuxiaoqin.uitls.respObj.RespBean;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jobob
 * @since 2021-10-29
 */
@RestController
@RequestMapping("/ad")
public class AdController {
    @Autowired
    private IAdService adService;

    @ApiOperation(value = "登录之后返回token")
    @PostMapping("/login")
    public RespBean login(AdLoginParam adLoginParam, HttpServletRequest request) throws InvalidKeySpecException, NoSuchAlgorithmException {

        //return adService.login(adLoginParam.getUsername(),adLoginParam.getPassword(),adLoginParam.getCode(),request);
        return adService.login(adLoginParam.getUsername(),adLoginParam.getPassword(),request);
    }

}
